package com.xjm_cloud_admin.adpater;

import com.xjm_cloud_admin.domain.XjmShare;
import com.xjm_cloud_admin.domain.XjmUser;
import com.xjm_cloud_admin.domain.vo.resp.ShareResp;
import com.xjm_cloud_admin.domain.vo.resp.UserInfoRespVo;

/**
 * @author 浪漫写尽歌谱
 */
public class UserVoAdapter {

    public static UserInfoRespVo getUserInfoRespVo(XjmUser user) {
        return UserInfoRespVo.builder()
                .uid(user.getUid())
                .nickname(user.getNickname())
                .avatar(user.getAvatar())
                .email(user.getEmail())
                .gender(user.getGender())
                .cloudSize(user.getCloudSize())
                .surplusCloudSize(user.getSurplusCloudSize())
                .build();
    }

    public static ShareResp getUserAndShareInfoResp(XjmUser user, XjmShare xjmShare) {
        return ShareResp.builder()
                .nickname(user.getNickname())
                .avatar(user.getAvatar())
                .id(xjmShare.getId())
                .fileName(xjmShare.getFileName())
                .createTime(xjmShare.getCreateTime())
                .savingTime(xjmShare.getSavingTime())
                .build();
    }

}
